package com.balabala.gym_user.controller.app;

import com.balabala.gym_user.pojo.entity.ShippingAddress;
import com.balabala.gym_user.service.ShippingAddressService;
import com.balabala.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 何涛
 * @Date: 2023/05/02/ 19:27
 * @description 收货地址controller
 */
@RestController
@RequestMapping("/app/shippingAddress")
@CrossOrigin
@Slf4j
@Api(tags = "收货地址前台接口")
public class ShippingAddressAppController {
    @Autowired
    ShippingAddressService shippingAddressService;

    @GetMapping("/findUserAllShippingAddress")
    @ApiOperation("查询用户所有收获地址")
    public Result findUserAllShippingAddress()
    {
        //todo 待完善
        return Result.ok();
    }
    @ApiOperation("添加用户收货地址")
    @PostMapping("addUserShippingAddress")
    public Result addUserShippingAddress(@RequestBody ShippingAddress shippingAddress)
    {
        log.info("添加用户收货地址，地址为：{}",shippingAddress);
        return Result.judge(shippingAddressService.save(shippingAddress));
    }

}
